package com.denlaku.longan.repository;

import com.denlaku.longan.dao.ObjectTagRelDao;
import com.denlaku.longan.qo.ObjPermQuery;
import com.denlaku.longan.vo.ObjectTagRel;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author tianx
 */
@Repository
public class ObjectTagRelRepository {
    @Autowired
    private ObjectTagRelDao objectTagRelDao;

    /**
     * 批量绑定标签
     *
     * @param tenantId 租户ID
     * @param relList 绑定标签列表
     */
    public void batchAdd(Long tenantId, List<ObjectTagRel> relList) {
        if (CollectionUtils.isNotEmpty(relList)) {
            objectTagRelDao.batchAdd(tenantId, relList);
        }
    }

    /**
     * 查询绑定标签列表
     *
     * @param query 查询参数
     * @return 绑定标签列表
     */
    public List<ObjectTagRel> list(ObjPermQuery query) {
        return objectTagRelDao.list(query);
    }

    /**
     * 删除绑定标签
     *
     * @param query 查询参数
     */
    public void delete(ObjPermQuery query) {
        objectTagRelDao.delete(query);
    }
}
